package fr.umlv.ig.metroFactory;

import java.awt.Color;
import java.util.HashMap;
import java.util.Map;

import javax.swing.Icon;
import javax.swing.ImageIcon;

/**
 * Factory which contains the images used in the application.
 * @author jenseric
 *
 */
public class GraphicFactory {
	
	public static final ImageIcon IMAGEABOUT =  new ImageIcon(GraphicFactory.class.getResource("images/AboutJacquesBeauheur.png"));
	public static final ImageIcon ICONABOUT =  new ImageIcon(GraphicFactory.class.getResource("images/about_icon.png"));
	public static final ImageIcon ICONHELP =  new ImageIcon(GraphicFactory.class.getResource("images/help_icon.gif"));
	public static final ImageIcon ICONTOOL = new ImageIcon(GraphicFactory.class.getResource("images/tool.png"));
	
	public static final ImageIcon ICONPLAY = new ImageIcon(GraphicFactory.class.getResource("images/Play.png"));
	public static final ImageIcon ICONPAUSE= new ImageIcon(GraphicFactory.class.getResource("images/Pause.png"));
	public static final ImageIcon ICONSTAR= new ImageIcon(GraphicFactory.class.getResource("images/Star.png"));
	public static final ImageIcon ICONINFO= new ImageIcon(GraphicFactory.class.getResource("images/Info.png"));
	public static final ImageIcon ICONEXIT = new ImageIcon(GraphicFactory.class.getResource("images/Quit.png"));

	
	public static final ImageIcon ICONSTATION =  new ImageIcon(GraphicFactory.class.getResource("images/icon_station.png"));
	public static final ImageIcon ICONSTATIONSTOP = new ImageIcon(GraphicFactory.class.getResource("images/icon_stop.jpg"));
	
	
	public static final ImageIcon ICONLINE = new ImageIcon(GraphicFactory.class.getResource("images/icon_line.png"));
	public static final ImageIcon ICONTRAIN =  new ImageIcon(GraphicFactory.class.getResource("images/icon_train.jpg"));
	
	public static final ImageIcon ICONLINE1 = new ImageIcon(GraphicFactory.class.getResource("images/pa_metro_ligne_1.gif"));
	public static final ImageIcon ICONLINE2 = new ImageIcon(GraphicFactory.class.getResource("images/pa_metro_ligne_2.gif"));
	public static final ImageIcon ICONLINE3 = new ImageIcon(GraphicFactory.class.getResource("images/pa_metro_ligne_3.gif"));
	public static final ImageIcon ICONLINE3BIS = new ImageIcon(GraphicFactory.class.getResource("images/pa_metro_ligne_3b.gif"));
	public static final ImageIcon ICONLINE4 = new ImageIcon(GraphicFactory.class.getResource("images/pa_metro_ligne_4.gif"));
	public static final ImageIcon ICONLINE5 = new ImageIcon(GraphicFactory.class.getResource("images/pa_metro_ligne_5.gif"));
	public static final ImageIcon ICONLINE6 = new ImageIcon(GraphicFactory.class.getResource("images/pa_metro_ligne_6.gif"));
	public static final ImageIcon ICONLINE7 = new ImageIcon(GraphicFactory.class.getResource("images/pa_metro_ligne_7.gif"));
	public static final ImageIcon ICONLINE8 = new ImageIcon(GraphicFactory.class.getResource("images/pa_metro_ligne_8.gif"));
	public static final ImageIcon ICONLINE9 = new ImageIcon(GraphicFactory.class.getResource("images/pa_metro_ligne_9.gif"));
	public static final ImageIcon ICONLINE10 = new ImageIcon(GraphicFactory.class.getResource("images/pa_metro_ligne_10.gif"));
	public static final ImageIcon ICONLINE11 = new ImageIcon(GraphicFactory.class.getResource("images/pa_metro_ligne_11.gif"));
	public static final ImageIcon ICONLINE12 = new ImageIcon(GraphicFactory.class.getResource("images/pa_metro_ligne_12.gif"));
	public static final ImageIcon ICONLINE13 = new ImageIcon(GraphicFactory.class.getResource("images/pa_metro_ligne_13.gif"));
	public static final ImageIcon ICONLINE14 = new ImageIcon(GraphicFactory.class.getResource("images/pa_metro_ligne_14.gif"));

	public static final Color BACKGROUND = new Color(255, 252, 223);
	
	/**
	 *Map which associates name of lines and Colors.
	 */
	private static final Map<String, Color> getColors = new HashMap<String, Color>(14);
	
	/**
	 * Map which associates name of lines and Icons.
	 */
	private static final Map<String, ImageIcon> getLinesIcons = new HashMap<String, ImageIcon>(14);
	
	/**
	 * Inits the Colors of each line
	 */
	public static void initColors() {
		getColors.put("1", new Color(254, 206, 0));
		getColors.put("2", new Color(0, 101, 174));
		getColors.put("3", new Color(159, 151, 26));
		getColors.put("3bis", new Color(153,212,222));
		getColors.put("4", new Color(190, 65, 141));
		getColors.put("5", new Color(241, 144, 67));
		getColors.put("6", new Color(132, 194, 142));
		getColors.put("7", new Color(242, 164, 183));
		getColors.put("7bis", new Color(132, 194, 142));
		getColors.put("8", new Color(205, 172, 207));
		getColors.put("9", new Color(213, 201, 0));
		getColors.put("10", new Color(228, 179, 43));
		getColors.put("11", new Color(224, 176, 39));
		getColors.put("12", new Color(0, 126, 73));
		getColors.put("13", new Color(153, 212, 222));
		getColors.put("14", new Color(98, 34, 128));
	}
	
	/**
	 * Returns a color depends a line number.
	 * @param lineNumber the string representation of the line number of the line.
	 * @return the color depends the line number in parameter.
	 */
	public static Color getLineColor(String lineNumber) {
		return getColors.get(lineNumber);
	}
	
	/**
	 * Initializes the icon for each line.
	 */
	public static void initLinesIcons() {
		getLinesIcons.put("1", ICONLINE1);
		getLinesIcons.put("2", ICONLINE2);
		getLinesIcons.put("3", ICONLINE3);
		getLinesIcons.put("4", ICONLINE4);
		getLinesIcons.put("5", ICONLINE5);
		getLinesIcons.put("6", ICONLINE6);
		getLinesIcons.put("7", ICONLINE7);
		getLinesIcons.put("8", ICONLINE8);
		getLinesIcons.put("9", ICONLINE9);
		getLinesIcons.put("10", ICONLINE10);
		getLinesIcons.put("11", ICONLINE11);
		getLinesIcons.put("12", ICONLINE12);
		getLinesIcons.put("13", ICONLINE13);
		getLinesIcons.put("14", ICONLINE14);	
	}
	
	
	/**
	 * Returns the icon depends the line number in parameter.
	 * @param lineNumber the line number to foi,d.
	 * @return the icon depends the line number in parameter.
	 */
	public static Icon getLineIcone(String lineNumber) {
		return getLinesIcons.get(lineNumber);
	}
	
	
	

}
